using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PastCrew.Games.Chess.UserInterface
{
    public partial class ChessSharp : Form
    {
        public ChessSharp()
        {
            InitializeComponent();
            squareA1.AllowDrop = true;
            squareA2.AllowDrop = true;

        }

        private void OnMouseDown(object sender, MouseEventArgs e)
        {
            PictureBox source = sender as PictureBox;
            if (source != null)
            {
                DoDragDrop(source.Image, DragDropEffects.All);
            }
        }

        private void OnDragOver(object sender, DragEventArgs e)
        {
            //if(e.Data.GetDataPresent(DataFormats.Bitmap))
            //{
            //    e.Effect = DragDropEffects.Copy;
            //}
        }

        private void OnDragDrop(object sender, DragEventArgs e)
        {
            squareA2.Image = e.Data.GetData(DataFormats.Bitmap) as Bitmap;
        }

        private void OnDragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Bitmap))
            {
                e.Effect = DragDropEffects.Copy;
            }
        }
    }
}